<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>


	</head>
	<body>
		<!--
			$.get(); // $.get(URL,callback);
			$.post();// $.post(URL,data,callback); 
			$.ajax(json);// 
			
			https://www.w3cschool.cn/jquery/jquery-ref-ajax.html
			
			// url
			// method   GET  POST
			// async   	异步还是同步
			// data     提交给服务器的数据 {"username":"zhangsan","password":"123456"}
			// dataType 如果不设定,结果默认为字符串,'json'这结果直接转换为json对象
			// success  执行成功执行的方法
			// error    出错执行的方法
		-->

		<button>测试</button>
		<div id="div01">

		</div>

		<script>
			$("button").click(function() {
				$.ajax(
					{
						url: "https://api.iyk0.com/60s",
					success: function(result) {
						console.log(result);
					}}
					);
			});

			// $("button").click(function(){
			// 	console.log("按钮被点击了");

			// 	$.ajax({
			// 		"url":"http://apis.juhe.cn/simpleWeather/query",
			// 		"method":"GET",
			// 		"async": true,
			// 		"data":{
			// 			"city":"无锡",
			// 			"key":"a18c5d3c557bb00df3caaa08c87b4322"
			// 		},
			// 		dataType:"json",
			// 		"success":function(data)
			// 		{
			// 			console.log(data);
			// 			console.log("天气:"+data.result.realtime.info+"温度:"+data.result.realtime.temperature);

			// 			$("#div01").html("天气:"+data.result.realtime.info+"温度:"+data.result.realtime.temperature);
			// 		}
			// 	});
			// });

			// Access to XMLHttpRequest at 'http://www.weather.com.cn/data/sk/101190408.html' from origin 'http://127.0.0.1:8848' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
			//	jquery.min.js:6          GET http://www.weather.com.cn/data/sk/101190408.html net::ERR_FAILED 200


			// chrome浏览器  安装 CROS插件
			// https://mybrowseraddon.com/access-control-allow-origin.html?v=0.1.6&type=install
		</script>


	</body>
</html>
